package com.py.credit.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.py.credit.common.logs.ExceptionLogger;
import com.py.credit.common.rest.RestServiceResult;
import com.py.credit.service.MaticLibraryService;
import com.py.framework.core.common.Page;

@RestController
@RequestMapping(value = "/MaticLibrary")
public class MaticLibraryController extends BaseController {

	@Autowired
	private MaticLibraryService maticLibraryService;

	@RequestMapping(value = "/selectZZForPage.do")
	public RestServiceResult<Object> selectInfoFromZZ(@RequestParam(value = "ZZRM", defaultValue = "") String ZZRM,
			Page page) {

		RestServiceResult<Object> result = new RestServiceResult<Object>();
		try {
			result.setData(maticLibraryService.selectInfoFromZZ(ZZRM, page));
			result.setCount(page.getTotalCount());
		} catch (Exception e) {
			result.setCode(RestServiceResult.CODE_UNKNOW);
			result.setMsg("数据异常！ERROR:" + e.getMessage());
			ExceptionLogger.error("接口MaticLibraryController#selectZZForPage.do", "接口异常！ERROR:" + e.getMessage(), e);
		}
		return result;
	}

	@RequestMapping(value = "/selectInfoFromDoctorForPage.do")
	public RestServiceResult<Object> selectInfoFromDoctorForPage(
			@RequestParam(value = "B000001", defaultValue = "") String B000001, Page page) {

		RestServiceResult<Object> result = new RestServiceResult<Object>();
		try {
			result.setData(maticLibraryService.selectInfoFromDoctorForPage(B000001, page));
			;
			result.setCount(page.getTotalCount());
		} catch (Exception e) {
			result.setCode(RestServiceResult.CODE_UNKNOW);
			result.setMsg("数据异常！ERROR:" + e.getMessage());
			ExceptionLogger.error("接口MaticLibraryController#selectInfoFromDoctorForPage.do",
					"接口异常！ERROR:" + e.getMessage(), e);
		}
		return result;
	}

	@RequestMapping(value = "/selectInfoFromNurseForPage.do")
	public RestServiceResult<Object> selectInfoFromNurseForPage(
			@RequestParam(value = "B000001", defaultValue = "") String B000001, Page page) {

		RestServiceResult<Object> result = new RestServiceResult<Object>();
		try {
			result.setData(maticLibraryService.selectInforFromNurseForPage(B000001, page));
			result.setCount(page.getTotalCount());
		} catch (Exception e) {
			result.setCode(RestServiceResult.CODE_UNKNOW);
			result.setMsg("数据异常！ERROR:" + e.getMessage());
			ExceptionLogger.error("接口MaticLibraryController#selectInfoFromNurseForPage.do",
					"接口异常！ERROR:" + e.getMessage(), e);
		}
		return result;
	}
}
